using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour
{
    public static GameManager instance;

    public bool ifHeroMode;
    public bool ifPossessionMode;

    // public int currentLevel = 0;
    // public int maxLevel = 3;
    
    private void Awake()
    {
        if (instance)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
    }

    public void LoadLevel(string levelName)
    {
        StartCoroutine(LoadLevelCoroutine(levelName));
    }

    private IEnumerator LoadLevelCoroutine(string levelName)
    {
        SceneManager.LoadScene(levelName);
        // currentLevel = level;
        yield return null;
        LevelManager.instance.GameStart();
        AudioManager.instance.BGMStart();
    }

    public void LoadMainMenu()
    {
        SceneManager.LoadScene("Start");
        AudioManager.instance.BGMStart();
    }
}
